package com.jieshuibao.service;

import java.util.List;

import javax.annotation.Resource;

import org.springframework.stereotype.Service;

import com.jieshuibao.mapper.InvoiceExMapper;
import com.jieshuibao.mapper.InvoiceMapper;
import com.jieshuibao.model.db.Invoice;
import com.jieshuibao.model.db.InvoiceExample;

@Service
public class InvoiceService{
	
	@Resource
	private InvoiceMapper invoiceMapper;
	@Resource
	private InvoiceExMapper invoiceExMapper;
	
	public void addInvoice(Invoice invoice) {
		invoiceMapper.insertSelective(invoice);
	}
	
	public void delInvoiceByUuid(String uuid) {
		invoiceMapper.deleteByPrimaryKey(uuid);
	}
	
	public void updateInvoice(Invoice invoice) {
		invoiceMapper.updateByPrimaryKeySelective(invoice);
	}
	
	public Invoice getInvoiceByUuid(String uuid) {
		return invoiceMapper.selectByPrimaryKey(uuid);
	}
	
	public List<Invoice> getPageInvoice(InvoiceExample invoiceExample) {
		return invoiceMapper.selectPage(invoiceExample);
	}
	public List<Invoice> getInvoice(InvoiceExample invoiceExample) {
		return invoiceMapper.selectByExample(invoiceExample);
	}
	
	public int countInvoice(InvoiceExample invoiceExample) {
		return invoiceMapper.countByExample(invoiceExample);
	}
	public Invoice getInvocieByPhoneNum(String phoneNum){
		return invoiceExMapper.selectInvoiceByPhoneNum(phoneNum);
	}
}
